QuickTime 4 API Documentation

Inside Macintosh: QuickTime Components

Previous | Overview | Contents | Next |

Controlling Sequence Grabber Channel Components

Sequence grabber channel components must provide a full set of functions that allow the sequence grabber component to control the preview or record operation. The sequence grabber component can use these functions to start and stop the operation, to pause data collection, and to write captured data to a movie. This section describes these functions.

The sequence grabber component uses the SGStartPreview function to start a preview operation. The SGStartRecord function starts a record operation. The SGStop function stops your channel component after a preview or record operation.

The sequence grabber component grants processing time to your channel component by calling the SGIdle function. The sequence grabber notifies you of update events by calling your SGUpdate function.

The sequence grabber pauses the current operation by calling the SGPause function.

The sequence grabber component calls your SGWriteSamples function to write captured data to a movie file after a record operation.

The sequence grabber component prepares your channel component for an upcoming preview or record operation by calling the SGPrepare function. This function also allows the sequence grabber component to verify that your component can support the parameters an application has specified. The SGRelease function releases system resources allocated during the SGPrepare function.

SGStartPreview

The SGStartPreview function instructs your channel to begin processing its source data. In preview mode, your component does not save any of the data it gathers from its source.

pascal ComponentResult SGStartPreview (SeqGrabComponent s);
s
Identifies the sequence grabber component that has connected to your channel component.

DESCRIPTION

Your channel component should immediately present the data to the user in the appropriate format, according to your channel's configuration (see "Configuration Functions for All Channel Components," which begins on Configuration Functions for All Channel Components , for information about functions that configure channels). Display video data in the destination display region; play sound data at the specified volume settings.

RESULT CODES

cantDoThatInCurrentMode

-9402

Request invalid in current mode

deviceCantMeetRequest

-9408

Device cannot support grabber

File Manager errors Memory Manager errors

SEE ALSO

The sequence grabber component stops the preview process by calling your SGStop function, which is described on SGStop .

SGStartRecord

The SGStartRecord function instructs your channel component to begin recording data from its source. The sequence grabber component stores the collected data according to the recording parameters that the calling application specified with the sequence grabber component's SGSetDataOutput function (described in the chapter "Sequence Grabber Components" in this book). Your channel component should immediately begin recording data in the appropriate format, according to your channel's configuration (see "Configuration Functions for All Channel Components," which begins on Configuration Functions for All Channel Components , for information about functions that configure channels).

pascal ComponentResult SGStartRecord (SeqGrabComponent s);
s
Identifies the sequence grabber component that has connected to your channel component.

DESCRIPTION

The sequence grabber component can switch from previewing to recording by calling this function during a preview operation--the sequence grabber need not stop the preview operation first.

RESULT CODES

cantDoThatInCurrentMode

-9402

Request invalid in current mode

notEnoughMemoryToGrab

-9403

Insufficient memory for record operation

notEnoughDiskSpaceToGrab

-9404

Insufficient disk space for record operation

deviceCantMeetRequest

-9408

Device cannot support grabber

File Manager errors Memory Manager errors

SEE ALSO

The sequence grabber component stops the recording process by calling your SGStop function, which is described on SGStop .

SGIdle

The SGIdle function provides processing time to your channel component.

pascal ComponentResult SGIdle (SeqGrabComponent s);
s
Identifies the sequence grabber component that has connected to your channel component.

DESCRIPTION

After starting a preview or record operation, the application calls the sequence grabber component's SGIdle function as often as possible. The sequence grabber component then calls your SGIdle function. This continues until the calling application stops the operation by calling the SGStop sequence grabber function.

Your SGIdle function reports several status and error conditions by means of its result code. If your component returns a nonzero result code during a record operation, the application should still call the SGStop function (described on SGStop ) so that the sequence grabber component can store the data it has collected.

RESULT CODES

File Manager errors Memory Manager errors

SGUpdate

The SGUpdate function allows you to learn about update events. This gives you an opportunity to update your display.

pascal ComponentResult SGUpdate (SeqGrabComponent s,
                                         RgnHandle updateRgn);
s
Identifies the sequence grabber component that has connected to your channel component.

updateRgn
Indicates the part of the window that has been changed. This parameter specifies a portion of the window that has been changed. Applications can obtain this information by examining the appropriate window record. For example, they may call the sequence grabber in this manner:

            SGUpdate (theSG, ((WindowPeek)updateWindow)->updateRgn);
If this parameter is set to nil , use the window's current visible region.

DESCRIPTION

Applications call the sequence grabber's SGUpdate function whenever they receive an update event for a window that contains a sequence grabber display. The sequence grabber then calls each affected channel. Applications should call this function before calling the Window Manager's BeginUpdate function.

RESULT CODE

deviceCantMeetRequest

-9408

Device cannot support grabber

SGStop

The SGStop function stops a preview or record operation.

pascal ComponentResult SGStop (SeqGrabComponent s);
s
Identifies the sequence grabber component that has connected to your channel component.

DESCRIPTION

In the case of a record operation, the sequence grabber component stores the collected movie data in the assigned movie file. The sequence grabber component then calls your SGWriteSamples function (described in the next section) to place the references to the captured data into the movie after it calls SGStop .

Warning
It is dangerous to allow an update event to occur during recording. Many digitizers capture directly to the screen, and an update event will result in data loss.

RESULT CODES

File Manager errors Memory Manager errors

SGWriteSamples

The sequence grabber component calls the SGWriteSamples function when it is ready to add recorded data to a movie.

pascal ComponentResult SGWriteSamples (SGChannel c, Movie m,
                                          AliasHandle theFile);
c
Identifies the channel connection for this operation.

m
Identifies the movie to which your component should add the captured data. Your component should not make any other changes to the movie identified by this reference. Use the SGWriteMovieData function, described on SGWriteMovieData .

theFile
Identifies the movie file. The sequence grabber component provides this alias so that you can supply it to the Movie Toolbox. You should not open this file or write to it directly. Use the SGWriteMovieData function.

DESCRIPTION

The sequence grabber component calls this function when the recording operation is complete, after calling your SGStop function (described on SGStop ). In this manner, your channel component can avoid unnecessary Movie Toolbox overhead during the record operation.

SPECIAL CONSIDERATIONS

Your component should dispose of any buffered data and add the captured data to the movie. If necessary, use the Movie Toolbox's functions to create a track and a media. See the chapter "Movie Toolbox" in Inside Macintosh: QuickTime for details.

RESULT CODES

File Manager errors Memory Manager errors

SGPause

A sequence grabber component can suspend or restart a record or preview operation by calling the SGPause function.

pascal ComponentResult SGPause (SeqGrabComponent s, Byte pause);
s
Identifies the sequence grabber component that has connected to your channel component.

pause
Instructs your component to suspend or restart the current operation. The following values are valid:

seqGrabUnpause
Restart the current operation.

seqGrabPause
Pause the current operation.

DESCRIPTION

The sequence grabber component supplies a constant value in the paused parameter that instructs your component to pause or restart the current operation.

SPECIAL CONSIDERATIONS

Your component should not release any system resources or temporary memory associated with the current operation--you should be ready to restart the operation immediately.

RESULT CODES

deviceCantMeetRequest

-9408

Device cannot support grabber

File Manager errors Memory Manager errors

SGPrepare

The SGPrepare function instructs your component to get ready to begin a preview or record operation (or both)--the sequence grabber component specifies the operations.

pascal ComponentResult SGPrepare (SeqGrabComponent s,
                                          Boolean prepareForPreview,
                                          Boolean prepareForRecord);
s
Identifies the sequence grabber component that has connected to your channel component.

prepareForPreview
Instructs your component to prepare for a preview operation. The sequence grabber component sets this parameter to true to prepare for a preview operation. The sequence grabber component may set both the prepareForPreview and prepareForRecord parameters to true .

prepareForRecord
Instructs your component to prepare for a record operation. The sequence grabber component sets this parameter to true to prepare for a record operation. The sequence grabber component may set both the prepareForPreview and prepareForRecord parameters to true .

DESCRIPTION

Your component should do whatever is necessary to get ready to start the operation. The goal is to reduce the delay between the time when the sequence grabber calls your SGStartPreview function (described on SGStartPreview ) or SGStartRecord function (described on SGStartRecord ) and the time when the operation actually begins. This may involve allocating memory or readying special hardware.

SPECIAL CONSIDERATIONS

If the sequence grabber calls SGPrepare without subsequently starting a record or preview operation, it calls the SGRelease function (described in the next section) later. This allows your component to release any system resources it allocated during the SGPrepare function.

RESULT CODES

paramErr

-50

Invalid parameter specified

notEnoughDiskSpaceToGrab

-9404

Insufficient disk space for record operation

deviceCantMeetRequest

-9408

Device cannot support grabber

File Manager errors Memory Manager errors

SGRelease

The SGRelease function instructs your component to release any system resources it allocated during the SGPrepare function, which is described in the previous section.

pascal ComponentResult SGRelease (SeqGrabComponent s);
s
Identifies the sequence grabber component that has connected to your channel component.

DESCRIPTION

The sequence grabber component calls your SGRelease function whenever it calls SGPrepare without subsequently starting a record or preview operation.

SPECIAL CONSIDERATIONS

Note that the sequence grabber component may call SGRelease more than once after calling SGPrepare .


© 1999 Apple Computer, Inc.

Previous | Overview | Contents | Next